<?php

namespace App\Modules\Admin\Http\Controllers\Community;

use App\Modules\Admin\Http\Controllers\BaseController;
use App\Modules\Admin\Http\Requests\Community\CommunityRequest;
use App\Modules\Admin\Services\Water\Community\CommunityService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class CommunityController extends BaseController
{
    public function __construct(CommunityService $communityService)
    {
        $this->service = $communityService;
    }

    public function create(CommunityRequest $request): JsonResponse
    {
        return $this->createService($request);
    }

    public function update(CommunityRequest $request): JsonResponse
    {
        return $this->updateService($request);
    }
    public function getSelectlists(Request $request): JsonResponse
    {
        $result = $this->service->getSelectlists($request);
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }

    }
}
